package jeconbond.experiment.market.equilibrium;

import jeconbond.economic.resources.ResourceUtils;
import jeconbond.economic.systems.market.DefaultMarketRRSFactory;
import jeconbond.experiment.JEBExperimentFlow;
import jeconbond.experiment.generate.ProfitableNormFormGenerateDecorator;
import jeconbond.experiment.market.equilibrium.generate.MooreAgentsCreator;
import jeconbond.experiment.market.equilibrium.generate.MooreAutomataGenerator;
import jeconbond.experiment.market.equilibrium.generate.MooreEngineInitialiser;
import jeconbond.experiment.ui.reportage.EconomicContextER2CConverter;
import laboratoryQ.flatness.Point;
import laboratoryQ.experiment.settings.ReflectionBasedSettingsContainer;
import laboratoryQ.experiment.ui.reportage.ExperimentReportage;

public class MainAView2AKill {
	public static void main(String[] args) {
		System.out.println("\nBLOCKING SMALL Octipussy is same but ...");
		
		JEBExperimentFlow experimentFlow = new JEBExperimentFlow();
		MooreExperimentSettings settings = 
			new MooreExperimentSettings();
		settings.initialise();
		
		settings.stepSize = 70;
		settings.stepCount = 150;
		settings.agentsCount = 150;
		settings.chainLength = 5;
		settings.produceProfit = 1.3;
		settings.agentGreedPercent = 2.0;
		settings.initResourceExceedPercent = 0.9;
		settings.initMoney = 50.0;
		settings.observeCostsTraceLength = 15;
		settings.concurrentPricePercent = 0.5;
		
		settings.purchaseExceedUseTrackLength = 20;
		settings.purchaseExceedPassivePeriod = settings.stepSize;
		settings.utiliseExceedPeriod = settings.stepSize;
		settings.purchaseExceedDayBudget = (int) (settings.initMoney * settings.agentsCount / settings.stepSize);
		
		settings.rrsFactory = new DefaultMarketRRSFactory();
		settings.resources = ResourceUtils.generateResources("r", 9);
		settings.experiment = experimentFlow;
		settings.randomSeed = 0.0; 
		settings.zeroPoint = new Point(0.0, 0.0);
		settings.selectPropositionsPart = 1.0;
		settings.profitCostManagerFactory = MooreAutomataGenerator.MANAGER_FACTORY_INSTANCE;
		settings.validate();

		ReflectionBasedSettingsContainer settingsContainer =
			new ReflectionBasedSettingsContainer(settings);

		settingsContainer.sortFields(
			"stepSize",
			"stepCount",
			"agentsCount",
			"chainLength",
			"produceProfit",
			"agentGreedPercent",
			"initResourceExceedPercent",
			"initMoney",
			"observeCostsTraceLength",
			"concurrentPricePercent",
			"purchaseExceedUseTrackLength",
			"purchaseExceedPassivePeriod",
			"utiliseExceedPeriod",
			"purchaseExceedDayBudget",
			"randomSeed"
		);

		experimentFlow.automataGenerator = new ProfitableNormFormGenerateDecorator(new MooreAutomataGenerator());
		experimentFlow.agentCreator = new MooreAgentsCreator();
		experimentFlow.engineInitialiser = new MooreEngineInitialiser();
		
		ExperimentReportage experimentReportage =
			ExperimentReportage.newExperiment2componentReportage(
					settingsContainer,
					new EconomicContextER2CConverter("AView2AKill experiment equilibrium")
			);
		experimentReportage.showReportageFrame(args);
		
//		JEBExperimentControlKit experimentControlKit = new JEBExperimentControlKit(
//				settingsContainer,
//				UIUtils.COLORS_COLLECTION,
//				"AView2AKill experiment equilibrium"
//		);
//		JEBExperimentUIFront.showControlKit(experimentControlKit);
	}
}
